HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/orbi-individual/node_modules/next/dist/esm/lib/eslint/writeOutputFile.js
import { promises as fs } from "fs";
import path from "path";
import * as Log from "../../build/output/log";
import isError from "../../lib/is-error";
/**
 * Check if a given file path is a directory or not.
 * Returns `true` if the path is a directory.
 */ function isDirectory(/**  The path to a file to check. */ filePath) {
    return fs.stat(filePath).then((stat)=>stat.isDirectory()).catch((error)=>{
        if (isError(error) && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
            return false;
        }
        throw error;
    });
}
/**
 * Create a file with eslint output data
 */ export async function writeOutputFile(/** The name file that needs to be created */ outputFile, /** The data that needs to be inserted into the file */ outputData) {
    const filePath = path.resolve(process.cwd(), outputFile);
    if (await isDirectory(filePath)) {
        Log.error(`Cannot write to output file path, it is a directory: ${filePath}`);
    } else {
        try {
            await fs.mkdir(path.dirname(filePath), {
                recursive: true
            });
            await fs.writeFile(filePath, outputData);
            Log.info(`The output file has been created: ${filePath}`);
        } catch (err) {
            Log.error(`There was a problem writing the output file: ${filePath}`);
            console.error(err);
        }
    }
}

//# sourceMappingURL=writeOutputFile.js.map